#!/bin/bash
#leao:Wed Aug 21 07:06:45 PM CST 2024
#create $1.h $1.c
function build(){
typeset -u capital
capital=$1
mkdir $1 
cd "$1" || exit 1
touch $1.h $1.c 
echo "#ifndef __${capital}_H_
#define __${capital}_H_


#endif" > "$1.h"
echo "#include \"${1}.h\"
int main(int  argc,char *argv[]){


}" > "$1.c"

vim "$1.c" + 3
}
if [ -z "$1"]
then 
    echo "error:argcs"
    exit
fi
if [ -e $1 ]
then
echo "${1}已经存在,是否重构y/Y,退出程序n/N:"

read val
case $val in
    [yY]*)
        rm -rf $1*
        build $1;;
    [nN]*)
        exit 1;
esac
else
echo "$1不存在，是否创建y/Y,退出程序n/N"
read val
case $val in
    [yY]*)
        build $1;;
    [nN]*)
        exit 1;
esac
fi

